#pragma once

#include "../Common/Common.h"

#include "CameraBase.h"


class PSDF_CORE_DLL_DECL Camera3D : public CameraBase
{
public:
	Camera3D( OsgViewerBase * parentViewer, bool needRoam = true );

	~Camera3D();	

public:
	void				adjustCamera( Node * node, int viewWidth, int viewHeight );
	void				resize( int viewWidth, int viewHeight );

	void				worldToScreen( Vec3 world, int &x, int &y );
	void				screenToWorld( int scrX, int scrY, Vec3& worldNear, Vec3& worldFar );

private:
	void				setCameraViewMatrix();
	void				setCameraProjectionMatrix();

	void				moveViewpoint( int currMouseX, int currMouseY );
	void				translateViewpoint(int currMouseX, int currMouseY);
	void				rotateViewpoint(int currMouseX, int currMouseY);
	void				zoomIn( int delta );
	void				zoomOut( int delta );
	void				reset();

	void				onFly();
	void				onFollow();

private:
	Vec3				_currAt;
	Matrixd				_matRotate;
	Matrixd				_matScale;
	Matrixd				_matTrans;
};